<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件添加</title>
    <style>
        .box
        {
           width: 300px;
           height: 300px;
           background-color: red;
        }
        .btn
        {
            position: relative;
            left: 400px;
            top: 200px;
        }
    </style>
</head>
<body>

    <button class="btn">添加事件</button>
    <div class="box"></div>
    
    <script>
        var btnEl = document.querySelector(".btn");
        var divEl = document.querySelector(".box");
        btnEl.onclick = function()
        {
            console.log("给divEL添加点击事件");
        }
        
       function fn1()
       {
          console.log("添加事件1");
       }

       function fn2()
       {
          console.log("添加事件2");
       }

       btnEl.addEventListener("click",fn1);
       btnEl.addEventListener("click",fn2);

       btnEl.removeEventListener("click",fn1);

    </script>
    
</body>
</html>